// import seedrandom from 'seedrandom';

/** @description Class to generate avatars  */
export class AvatarGenerator {
  constructor() {}

  /** @description Generates random avatar image URL
   * @returns Random avatar image URL
   */
  generateRandomAvatar() {
    const topTypeOptions: Array<string> = [];
    topTypeOptions.push(
      'NoHair',
      'Eyepatch',
      'Hat',
      'Hijab',
      'Turban',
      'WinterHat1',
      'WinterHat2',
      'WinterHat3',
      'WinterHat4',
      'LongHairBigHair',
      'LongHairBob',
      'LongHairBun',
      'LongHairCurly',
      'LongHairCurvy',
      'LongHairDreads',
      'LongHairFrida',
      'LongHairFro',
      'LongHairFroBand',
      'LongHairNotTooLong',
      'LongHairShavedSides',
      'LongHairMiaWallace',
      'LongHairStraight',
      'LongHairStraight2',
      'LongHairStraightStrand',
      'ShortHairDreads01',
      'ShortHairDreads02',
      'ShortHairFrizzle',
      'ShortHairShaggyMullet',
      'ShortHairShortCurly',
      'ShortHairShortFlat',
      'ShortHairShortRound',
      'ShortHairShortWaved',
      'ShortHairSides',
      'ShortHairTheCaesar',
      'ShortHairTheCaesarSidePart'
    );

    const accessoriesTypeOptions: Array<string> = [];
    accessoriesTypeOptions.push(
      'Blank',
      'Kurt',
      'Prescription01',
      'Prescription02',
      'Round',
      'Sunglasses',
      'Wayfarers'
    );

    const facialHairTypeOptions: Array<string> = [];
    facialHairTypeOptions.push(
      'Blank',
      'BeardMedium',
      'BeardLight',
      'BeardMagestic',
      'MoustacheFancy',
      'MoustacheMagnum'
    );

    const facialHairColorOptions: Array<string> = [];
    facialHairColorOptions.push(
      'Auburn',
      'Black',
      'Blonde',
      'BlondeGolden',
      'Brown',
      'BrownDark',
      'Platinum',
      'Red'
    );

    const clotheTypeOptions: Array<string> = [];
    clotheTypeOptions.push(
      'BlazerShirt',
      'BlazerSweater',
      'CollarSweater',
      'GraphicShirt',
      'Hoodie',
      'Overall',
      'ShirtCrewNeck',
      'ShirtScoopNeck',
      'ShirtVNeck'
    );

    const eyeTypeOptions: Array<string> = [];
    eyeTypeOptions.push(
      'Close',
      'Cry',
      'Default',
      'Dizzy',
      'EyeRoll',
      'Happy',
      'Hearts',
      'Side',
      'Squint',
      'Surprised',
      'Wink',
      'WinkWacky'
    );

    const eyebrowTypeOptions: Array<string> = [];
    eyebrowTypeOptions.push(
      'Angry',
      'AngryNatural',
      'Default',
      'DefaultNatural',
      'FlatNatural',
      'RaisedExcited',
      'RaisedExcitedNatural',
      'SadConcerned',
      'SadConcernedNatural',
      'UnibrowNatural',
      'UpDown',
      'UpDownNatural'
    );

    const mouthTypeOptions: Array<string> = [];
    mouthTypeOptions.push(
      'Concerned',
      'Default',
      'Disbelief',
      'Eating',
      'Grimace',
      'Sad',
      'ScreamOpen',
      'Serious',
      'Smile',
      'Tongue',
      'Twinkle',
      'Vomit'
    );

    const skinColorOptions: Array<string> = [];
    skinColorOptions.push('Tanned', 'Yellow', 'Pale', 'Light', 'Brown', 'DarkBrown', 'Black');

    const hairColorTypes: Array<string> = [];
    hairColorTypes.push(
      'Auburn',
      'Black',
      'Blonde',
      'BlondeGolden',
      'Brown',
      'BrownDark',
      'PastelPink',
      'Platinum',
      'Red',
      'SilverGray'
    );

    const hatColorOptions: Array<string> = [];
    hatColorOptions.push(
      'Black',
      'Blue01',
      'Blue02',
      'Blue03',
      'Gray01',
      'Gray02',
      'Heather',
      'PastelBlue',
      'PastelGreen',
      'PastelOrange',
      'PastelRed',
      'PastelYellow',
      'Pink',
      'Red',
      'White'
    );

    const clotheColorOptions: Array<string> = [];
    clotheColorOptions.push(
      'Black',
      'Blue01',
      'Blue02',
      'Blue03',
      'Gray01',
      'Gray02',
      'Heather',
      'PastelBlue',
      'PastelGreen',
      'PastelOrange',
      'PastelRed',
      'PastelYellow',
      'Pink',
      'Red',
      'White'
    );

    function getRandom() {
      return function () {
        return Math.random();
      };
    }
    const rng = getRandom(); // ?
    return `https://avataaars.io/?accessoriesType=${
      accessoriesTypeOptions[Math.floor(rng() * accessoriesTypeOptions.length)]
    }&avatarStyle=Circle&clotheColor=${
      clotheColorOptions[Math.floor(rng() * clotheColorOptions.length)]
    }&clotheType=${clotheTypeOptions[Math.floor(rng() * clotheTypeOptions.length)]}&eyeType=${
      eyeTypeOptions[Math.floor(rng() * eyeTypeOptions.length)]
    }&eyebrowType=${
      eyebrowTypeOptions[Math.floor(rng() * eyebrowTypeOptions.length)]
    }&facialHairColor=${
      facialHairColorOptions[Math.floor(rng() * facialHairColorOptions.length)]
    }&facialHairType=${
      facialHairTypeOptions[Math.floor(rng() * facialHairTypeOptions.length)]
    }&hairColor=${hairColorTypes[Math.floor(rng() * hairColorTypes.length)]}&hatColor=${
      hatColorOptions[Math.floor(rng() * hatColorOptions.length)]
    }&mouthType=${mouthTypeOptions[Math.floor(rng() * mouthTypeOptions.length)]}&skinColor=${
      skinColorOptions[Math.floor(rng() * skinColorOptions.length)]
    }&topType=${topTypeOptions[Math.floor(rng() * topTypeOptions.length)]}`;
  }
}
new AvatarGenerator().generateRandomAvatar(); // ?
